package com.xiaoniu.forum.common.utils;

import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;

import java.util.List;
import java.util.Set;

public class ESQueryUtils {

    /**
     * @param fieldNames  要高亮的多个字段名
     * @return
     */
    public static HighlightBuilder getHighlightBuilder(List<String> fieldNames){
        HighlightBuilder highlightBuilder = new HighlightBuilder();
        highlightBuilder.preTags("<font color='red'>");
        highlightBuilder.postTags("</font>");
        for (String name:fieldNames){
            highlightBuilder.field(name);
        }
        return highlightBuilder;
    }


}
